package com.example.dockers.service;

import com.example.dockers.bean.Student;
import com.example.dockers.dao.StudentDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName StudentService
 * @Description TODO
 * @Auth ying.xiao
 * @Date 2021/7/19
 * @Version 1.0.0
 */
@Service
public class StudentServiceImpl implements StudentService {

    @Autowired
    private StudentDao studentDao;


    @Override
    public void add(Student student) {

        studentDao.save(student);

    }

    @Override
    public List<Student> queryAll() {

        List<Student> all = studentDao.findAll();
        return all;

    }

    @Override
    public void updateStu(Student student) {
        studentDao.saveAndFlush(student);
    }

    @Override
    public void delStu(Student student) {
        studentDao.delete(student);
    }
}
